package com.algorithm;

public class S1S2 {


    public static void main(String[] args) {

        System.out.println(s1s2("a", null));
        System.out.println(s1s2(null, "b"));
        System.out.println(s1s2("a", "b"));
    }


    static boolean s1s2(String s1, String s2) {

        if (s1 == s2) return true;
        //s1 and s2 is null
        if (s1 == null && s2 == null) return true;
        //at least s1 or s2 is null
        if (s1 == null || s2 == null) return false;
        //reach here  both s1 and s2 non null
        System.out.println("处理：s1=" + s1 + ",s2=" + s2);
        return s1.equals(s2);

    }

}
